#ifndef METAOBJECTOPERATION_H
#define METAOBJECTOPERATION_H
#include <vector>
#include <map>
#include <shared_mutex>
#include "type.h"
#include "ErrorCode.h"
#include <memory>

using namespace std;

namespace gitstore {

struct Object;
struct Branch;
struct Node;

class CMetaDataIOBase;

class CObjectOperation;
class CBranchOperation;
class CNodeOperation;

class CObjectOperation {
public:
    CObjectOperation();

public:
    ~CObjectOperation();

public:
    ErrorStatus setMainBranch(Object &object, const std::string br_name);
    ErrorStatus setNote(Object &object, const std::string& note);

public:
    ErrorStatus create(const std::string& obj_name, const std::string& ds_note,
                       const std::string& br_name, const std::string& br_note,
                       int type, int subtype,std::string& version, Object& object);

};

class CBranchOperation {
public:
    CBranchOperation();
    ~CBranchOperation();

public:
    ErrorStatus setVersion(Branch& branch, const std::string& version);
    ErrorStatus setNote(Branch& branch, const std::string& note);

public:
    ErrorStatus create(const std::string& obj_name, const std::string& br_name, const std::string& br_note,
                       const std::string& version, int type, Branch& branch_info);
};

class CNodeOperation {
public:
    CNodeOperation();

public:
    ~CNodeOperation();

public:
    ErrorStatus create(const std::string& obj_name, const std::string& version, const std::string& note,
                       int type, const std::vector<std::string>& parents, Node& node);
    ErrorStatus addChild(Node& node, const std::string& child_version);

};
}

#endif
